<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form method="post" id="form">
    <input type="hidden" name="id" value="{{ data.id }}">
用户名<input type="text" name="username" value="{{ data.username }}">

密码 <input type="password" name="password" value="{{ data.password }}">
身份 <select name="type">
    <option value="0">普通用户</option>
    <option value="1">商家</option>
    <option value="2">管理员</option>
</select>
<button id="add">修改</button>
    </form>
<script>
    $('#add').click(function () {
        formdata = new FormData($('#form')[0])
        ajax({
            url: 'http://127.0.0.1:8000/',
            type: 'POST',
            data: formdata,
            success: function () {
                alert('添加成功')
            },
            error: function () {
                alert('添加出错')
            }

        })
            .success(function () {
                alert('添加成功')
            })
            .error(function () {
                alert('添加出错')
            })
    })
</script>

</body>
</html>